package com.qingcheng.service.order;

import com.qingcheng.pojo.order.CategoryReport;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

public interface CategoryReportService{


    //查询完成交易的订单

    /**
     * "SELECT oi.category_id1 ,oi.category_id2,oi.category_id3 ,
     *
     * DATE_FORMAT(o.pay_time,'%Y-%m-%d') count_date,SUM(oi.num) num,
     *
     * SUM(oi.money) money FROM tb_order o,tb_order_item oi WHERE o.id=oi.order_id AND o.pay_status='1'
     *
     * AND  DATE_FORMAT(o.pay_time,'%Y-%m-%d')=#{date}
     *
     * GROUP BY  oi.category_id1 ,oi.category_id2,oi.category_id3 ,
     *
     *  DATE_FORMAT(o.pay_time,'%Y-%m-%d')"
     * @param date
     * @return
     */
    public List<CategoryReport> categoryReport(LocalDate date);


    //定时查询前一天的销售统计，并记录至数据库

    /**
     *
     */
    public void categoryTimed();


    /**
     *      SELECT \n" +
                 "\tcr.`category_id1` categoryId1,\n" +
                 "\tSUM(cr.`num`) num,\n" +
                 "\tSUM(cr.`money`) money,\n" +
                 "\tc.`name` categoryName\n" +
                 " FROM \n" +
                 "\tqingcheng_order.`tb_category_report` cr ,\n" +
                 "\tqingcheng_goods.`v_category`         c\n" +
                 "WHERE\n" +
                 "\tc.`id`=cr.`category_id1`\n" +
                 "\tAND cr.`count_date`>=#{date1}\n" +
                 "\tAND cr.`count_date`<=#{date2}\n" +
                 "GROUP BY \n" +
                 "\tcr.`category_id1`,c.`name`
     *
     *
     *
     *
     *
     * 根据一级分类，查询某段时间销售信息
     * @param date1
     * @param date2
     * @return
     */
    public List<Map> categoryId(String date1, String date2);










}
